﻿using System;

namespace KWBridge
{
    public partial class ParasForm2 : ParasForm
    {
        public ParasForm2( )
        {
            InitializeComponent( );
            InitButtonsClick( );
        }

        private void InitButtonsClick( )
        {
            btnAuthoring.Click += new EventHandler( btnAuthoring_Click );
            btnClose.Click += new EventHandler( btnClose_Click );
            btnSave.Click += new EventHandler( btnSave_Click );
            btnAlarmParas.Click += new EventHandler( btnAlarmParas_Click );
        }

        internal override void InitData( )
        {
            dic_ComboBox.Add( "风机" , kjParasUserControl1.cbb风机 );
            dic_ComboBox.Add( "风门" , kjParasUserControl1.cbb风门 );
            dic_ComboBox.Add( "烟雾" , kjParasUserControl1.cbb烟雾 );
            dic_ComboBox.Add( "风筒" , kjParasUserControl1.cbb风筒 );
            dic_ComboBox.Add( "开停" , kjParasUserControl1.cbb开停 );
            dic_ComboBox.Add( "开关" , kjParasUserControl1.cbb开关 );
            dic_ComboBox.Add( "断电" , kjParasUserControl1.cbb断电 );
            dic_ComboBox.Add( "馈电" , kjParasUserControl1.cbb馈电 );
            dic_ComboBox.Add( "闭锁" , kjParasUserControl1.cbb闭锁 );
            dic_ComboBox.Add( "控制" , kjParasUserControl1.cbb控制 );
            dic_ComboBox.Add( "分站" , kjParasUserControl1.cbb分站 );
            dic_ComboBox.Add( "供电" , kjParasUserControl1.cbb供电 );

            dic_ComboBox2.Add( "风机" , kjParasUserControl2.cbb风机 );
            dic_ComboBox2.Add( "风门" , kjParasUserControl2.cbb风门 );
            dic_ComboBox2.Add( "烟雾" , kjParasUserControl2.cbb烟雾 );
            dic_ComboBox2.Add( "风筒" , kjParasUserControl2.cbb风筒 );
            dic_ComboBox2.Add( "开停" , kjParasUserControl2.cbb开停 );
            dic_ComboBox2.Add( "开关" , kjParasUserControl2.cbb开关 );
            dic_ComboBox2.Add( "断电" , kjParasUserControl2.cbb断电 );
            dic_ComboBox2.Add( "馈电" , kjParasUserControl2.cbb馈电 );
            dic_ComboBox2.Add( "闭锁" , kjParasUserControl2.cbb闭锁 );
            dic_ComboBox2.Add( "控制" , kjParasUserControl2.cbb控制 );
            dic_ComboBox2.Add( "分站" , kjParasUserControl2.cbb分站 );
            dic_ComboBox2.Add( "供电" , kjParasUserControl2.cbb供电 );

            dic_StatesCheckBox.Add( "超上限" , kjParasUserControl1.cb超上限 );
            dic_StatesCheckBox.Add( "超下限" , kjParasUserControl1.cb超下限 );
            dic_StatesCheckBox.Add( "超断电" , kjParasUserControl1.cb超断电 );
            dic_StatesCheckBox.Add( "调校" , kjParasUserControl1.cb调校 );
            dic_StatesCheckBox.Add( "超量程" , kjParasUserControl1.cb超量程 );
            dic_StatesCheckBox.Add( "负漂" , kjParasUserControl1.cb负漂 );
            dic_StatesCheckBox.Add( "断线" , kjParasUserControl1.cb断线 );
            dic_StatesCheckBox.Add( "通信中断" , kjParasUserControl1.cb通信中断 );
            dic_StatesCheckBox.Add( "故障" , kjParasUserControl1.cb故障 );
            dic_StatesCheckBox.Add( "未知" , kjParasUserControl1.cb未知 );

            dic_StatesCheckBox2.Add( "超上限" , kjParasUserControl2.cb超上限 );
            dic_StatesCheckBox2.Add( "超下限" , kjParasUserControl2.cb超下限 );
            dic_StatesCheckBox2.Add( "超断电" , kjParasUserControl2.cb超断电 );
            dic_StatesCheckBox2.Add( "调校" , kjParasUserControl2.cb调校 );
            dic_StatesCheckBox2.Add( "超量程" , kjParasUserControl2.cb超量程 );
            dic_StatesCheckBox2.Add( "负漂" , kjParasUserControl2.cb负漂 );
            dic_StatesCheckBox2.Add( "断线" , kjParasUserControl2.cb断线 );
            dic_StatesCheckBox2.Add( "通信中断" , kjParasUserControl2.cb通信中断 );
            dic_StatesCheckBox2.Add( "故障" , kjParasUserControl2.cb故障 );
            dic_StatesCheckBox2.Add( "未知" , kjParasUserControl2.cb未知 );

            dic_TypesCheckBox.Add( "甲烷" , kjParasUserControl1.cb甲烷 );
            dic_TypesCheckBox.Add( "一氧化碳" , kjParasUserControl1.cb一氧化碳 );
            dic_TypesCheckBox.Add( "风速" , kjParasUserControl1.cb风速 );
            dic_TypesCheckBox.Add( "温度" , kjParasUserControl1.cb温度 );
            dic_TypesCheckBox.Add( "压力" , kjParasUserControl1.cb压力 );
            dic_TypesCheckBox.Add( "全部模" , kjParasUserControl1.cb全部模 );
            dic_TypesCheckBox.Add( "主扇" , kjParasUserControl1.cb主扇 );
            dic_TypesCheckBox.Add( "局扇" , kjParasUserControl1.cb局扇 );
            dic_TypesCheckBox.Add( "风机" , kjParasUserControl1.cb局扇 );
            dic_TypesCheckBox.Add( "断电" , kjParasUserControl1.cb断电 );

            //dic_TypesCheckBox.Add("断电器", kjParasUserControl1.cb断电);
            dic_TypesCheckBox.Add( "烟雾" , kjParasUserControl1.cb烟雾 );
            dic_TypesCheckBox.Add( "风门" , kjParasUserControl1.cb风门 );
            dic_TypesCheckBox.Add( "全部开" , kjParasUserControl1.cb全部开 );

            dic_TypesCheckBox2.Add( "甲烷" , kjParasUserControl2.cb甲烷 );
            dic_TypesCheckBox2.Add( "一氧化碳" , kjParasUserControl2.cb一氧化碳 );
            dic_TypesCheckBox2.Add( "风速" , kjParasUserControl2.cb风速 );
            dic_TypesCheckBox2.Add( "温度" , kjParasUserControl2.cb温度 );
            dic_TypesCheckBox2.Add( "压力" , kjParasUserControl2.cb压力 );
            dic_TypesCheckBox2.Add( "全部模" , kjParasUserControl2.cb全部模 );
            dic_TypesCheckBox2.Add( "主扇" , kjParasUserControl2.cb主扇 );
            dic_TypesCheckBox2.Add( "局扇" , kjParasUserControl2.cb局扇 );
            dic_TypesCheckBox2.Add( "风机" , kjParasUserControl2.cb局扇 );
            dic_TypesCheckBox2.Add( "断电" , kjParasUserControl2.cb断电 );

            //dic_TypesCheckBox.Add("断电器", kjParasUserControl2.cb断电);
            dic_TypesCheckBox2.Add( "烟雾" , kjParasUserControl2.cb烟雾 );
            dic_TypesCheckBox2.Add( "风门" , kjParasUserControl2.cb风门 );
            dic_TypesCheckBox2.Add( "全部开" , kjParasUserControl2.cb全部开 );
        }

        internal override void ConvertParasFrom( )
        {
            //tbCoalMineName.Text = mainForm.CoalMineName;
            //tbCoalMineId.Text = mainForm.CoalMineId.ToString();
            //tbInterval.Text = mainForm.Interval.ToString();
            //tbIPAddress.Text = mainForm.ServerIp;

            //int n = mainForm.nBreakInterval;
            //tbBreakInterval.Text = n.ToString();

            //kjParasUserControl1.tbPath.Text = mainForm.Path;
            //kjParasUserControl1.tbDevFile.Text = mainForm.DevFileName;
            //kjParasUserControl1.tbRtData.Text = mainForm.RtDataName;
            //kjParasUserControl1.cbbKJType.Text = mainForm.KJType;

            //foreach (string type in mainForm.DigitalTypes)
            //{
            //    SetDigitalState(type);
            //}

            //// 获取报警选项
            //GetAlarmOprions();

            //kjParasUserControl2.tbPath.Text = mainForm.Path2;
            //kjParasUserControl2.tbDevFile.Text = mainForm.DevFileName2;
            //kjParasUserControl2.tbRtData.Text = mainForm.RtDataName2;
            //kjParasUserControl2.cbbKJType.Text = mainForm.KJType2;

            //foreach (string type in mainForm.DigitalTypes)
            //{
            //    SetDigitalState2(type);
            //}
            //// 获取报警选项2
            //GetAlarmOprions2();
        }

        internal override void ConvertParasTo( )
        {
            base.ConvertParasTo( );

            //mainForm.CoalMineName = tbCoalMineName.Text;
            //uint nId = mainForm.CoalMineId;
            //uint.TryParse(tbCoalMineId.Text, out nId);
            //mainForm.CoalMineId = nId;
            //int n = 10;
            //if (int.TryParse(tbInterval.Text, out n))
            //{
            //    mainForm.Interval = n;
            //}

            //if (int.TryParse(tbBreakInterval.Text, out n))
            //{
            //    mainForm.nBreakInterval = n;
            //}
            //if (mainForm.nBreakInterval >= 10)
            //{
            //    mainForm.nBreakInterval = 10;
            //}
            //mainForm.ServerIp = tbIPAddress.Text;

            //mainForm.Path = kjParasUserControl1.tbPath.Text;
            //mainForm.DevFileName = kjParasUserControl1.tbDevFile.Text;
            //mainForm.RtDataName = kjParasUserControl1.tbRtData.Text;
            //mainForm.KJType = kjParasUserControl1.cbbKJType.Text;

            //mainForm.Path2 = kjParasUserControl2.tbPath.Text;
            //mainForm.DevFileName2 = kjParasUserControl2.tbDevFile.Text;
            //mainForm.RtDataName2 = kjParasUserControl2.tbRtData.Text;
            //mainForm.KJType2 = kjParasUserControl2.cbbKJType.Text;

            //foreach (string type in mainForm.DigitalTypes)
            //{
            //    GetDigitalState(type);
            //}

            //SetAlarmOptions();

            //foreach (string type in mainForm.DigitalTypes)
            //{
            //    GetDigitalState2(type);
            //}
            //SetAlarmOptions2();

            //mainForm.UpdateParas2();
        }
    }
}